package com.eric.socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class ServerSocketTest {

	public static void main(String[] args) {
      System.out.print("开启服务!");
		try {
			ServerSocket ss = new ServerSocket(30000);
			while(true){
				Socket  socket = ss.accept();
				OutputStream os = socket.getOutputStream();
				os.write("您好，恭喜您中奖了！".getBytes("utf-8"));
				os.close();
				socket.close();
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
      
	}
	
	

}
